<template>
  <el-card class="box-card1">
        <div slot="header" class="clearfix">
          <span>监控</span>
          <el-tooltip content="统计" placement="top">
            <i class="iconfont icon-askoutline"></i>
          </el-tooltip>
        </div>
        <div class="text item">
          <ul class="monitor">
            <li>
              <span>网关离线</span>
              <span>{{ devictObj.LoRaWAN.total }}</span>
            </li>
            <li>
              <span>节点离线</span>
              <span>{{ devictObj.sensor.offline }}</span>
            </li>
            <li>
              <span>传感器低电量</span>
              <span>{{ devictObj.sensor.lowBattery }}</span>
            </li>
          </ul>
        </div>
      </el-card>
</template>

<script>
//调用后台接口
import { $deviceCount } from "@/api/index.js";
export default {
    name:"Monitor",
    data() {
    return {
      devictObj: {
        LoRaPP: "",
        LoRaWAN: "",
        group: "",
        sensor: "",
      },
    };
  },
  mounted() {
    $deviceCount().then((res) => {
      this.devictObj = res.data.data;
    });
  },
}
</script>

<style scoped lang="scss">
.text {
  display: flex;
  align-items: center;
  justify-content: space-around;
  font-size: 14px;
}

.item {
  margin-bottom: 18px;
}

.clearfix {
  font-size: 13px;
  font-weight: bold;
}
.clearfix:after {
  clear: both;
}
ul,
li {
  list-style: none;
}
.box-card1 {
  width: 20%;
  .monitor {
    width: 100%;
    display: flex;
    justify-content: space-between;
    flex-direction: column;
  }
  .monitor li {
    display: flex;
    justify-content: space-between;
    height: 30px;
  }
  .monitor li span:nth-of-type(1) {
    font-size: 13px;
    font-weight: 600;
  }
  .monitor li span:nth-of-type(2) {
    width: 40px;
    height: 20px;
    line-height: 20px;
    font-weight: 600;
    background: #ddf0e0;
    color: #8dab78;
    border-radius: 10px;
    text-align: center;
  }
  .monitor li:nth-of-type(3) span:nth-of-type(2) {
    background: #fbdadb;
    color: #ec5768;
  }
}
</style>